<%-- 
    Document   : adminPage
    Created on : Sep 22, 2012, 8:35:03 AM
    Author     : lion
--%>

<%@page import="sun.text.normalizer.UBiDiProps"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Iterator"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="dao.*,entities.*" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="../../js/jquery.validate.min.js"></script>
        <script type="text/javascript" src="../../js/toggle.js"></script>
        <link  href="../style.css" rel="stylesheet" type="text/csss"/>
        <script  type="text/javascript">
            $(document).ready(function(){
                $("#frmCourse").validate();
            });
        </script>
        <style type="text/css">
            table{
                border-collapse:collapse;
                width: 100%;
                text-align: center;
            }
            table,th, td
            {
                border: 1px solid black;
            }
            th{
                height: 50px;
            }
        </style>
        <title>Course management</title>
    </head>
    <%
        CourseDao courseDao = new CourseDao();
    %>
    <body>
        <div class="body">
            <%@include file="../template/header.html" %>
            <%@include file="../../template/displayMessage.jsp"%>
            <%@include file="sidebar.html"%>
            <div id="contentbox">
                <table>
                    <thead>
                        <tr>
                            <th>Course name</th>
                            <th>Fee</th>
                            <th>Prerequisite</th>
                        </tr>
                    </thead>
                    <%
                        for (Iterator it = courseDao.getListCourse().iterator(); it.hasNext();) {
                            Course course = (Course) it.next();%>
                            <tr>
                                <td> <%= course.getCourseName()%></td>
                                <td><%= course.getFee()%></td>
                                <td><%= course.getPrerequisite()%></td>
                            </tr>

                    <%}
                    %>
                </table><br/>
                <!--      Select course
                            <select name="courseSelect">
                <%
                    for (Iterator it = courseDao.getListCourse().iterator(); it.hasNext();) {
                        Course course = (Course) it.next();
                        out.write("<option value='" + course.getCourseid() + "'>"
                                + course.getCourseName()
                                + "</option>");
                    }
                %>
            </select>-->
                <form method="post" action="../../AddCourseServlet" id="frmCourse">
                    <table>
                        <tr>
                            <td>Course name</td>
                            <td><input type="text" id="txtCoursename" name="txtCoursename" class="required"/></td>
                        </tr>
                        <tr>
                            <td>Fee</td>
                            <td><input type="text" id="txtFee" name="txtFee" class="required number"/></td>
                        </tr>
                        <tr>
                            <td>Prerequisite</td>
                            <td><input type="text" id="txtPrerequisite" name="txtPrerequisite" class="required"/></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input type="submit" name="Submit"/></td>
                        </tr>
                    </table>
                </form>
            </div>
            <div class="clear"></div>
            <%@include file="../../template/displayUser.jsp" %>
            <%@include file="../template/footer.html" %>
        </div>
    </body>
</html>
